package cs241.assignment8.priorityqueue;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Driver {
	
	public static void main(String [] args){
		
		RegistrationQueue queue = new RegistrationQueue();

		File studentsFile = new File(getPath() + "/students");
		Scanner scan = null;
		Student student = null;
		
		try {
			 scan = new Scanner(studentsFile);
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		/*
		 * Use the scanner to read each line of the file and place it into a student object
		 */
		while(scan.hasNextLine()){
			
			student = new Student();
			student.setName(scan.next());
			student.setIsFourBear(scan.nextInt());
			student.setIsAthlete(scan.nextInt());
			student.setGPA(scan.nextFloat());
			student.setDonation(scan.nextFloat());
			
			queue.add(student);
		}
		
		//Print the queue
		while(queue.size() > 0){
			System.out.println(queue.poll());
		}
	}
	
	private static String getPath(){
		String path = null;
		try {
			path = new File(".").getCanonicalPath();
		} catch (IOException e) {
			e.printStackTrace();
		}
	
		return path;
	}
}
